<template>
  <div>
    <h2>{{ message }}</h2>
    <h3>{{ID}}</h3>
    <button@click="go">点击返回首页</button@click=>
    <button @click="gosku">点击去商品列表</button>
    <router-view></router-view>
  </div>
</template>

<script>
//引入方法判断路由有无
import judgeRoute from '../../utils/judgeRoute'
export default {
  name: 'DemoSon1',
  data() {
    return {
      message: '我是son1',
      ID: '我是Hi传过来的参数',
    }
  },

  mounted() {},

  methods: {
    go() {
      this.$router.push('/hellow')
    },
    //封装注册方法判断路由有无
    judgeRoute,
    gosku() {
      this.$router.push('/hi/sonOne/sku')
    },
  },
  created() {
    //获取query传参
    const q = this.$route.query.useId
    // 获取params传参
    const IDD = this.$route.params.useID

    const name = this.$route.query.name
    const nameid = this.$route.query.nameid
    //调用方法判断路由有无
    this.judgeRoute(q, IDD, name, nameid)
    console.log(name, nameid)
  },
}
</script>

<style lang="scss" scoped>
</style>